--[[
     Created by IntelliJ IDEA.
     User: 毛凯
     Date: 2018/7/30
     Time: 9:38
     参数：ARGV[1]:活动id
     参数：ARGV[2]:flag  1为随机，2为点赞，3为被点赞
     返回：返回数组：
           res [min,max]
--]]

--记录活动红包以及人数key
local ACTINFOKEY = 'act_'..ARGV[1]
--记录初始化信息key
local ACTINITKEY = 'actInit_'..ARGV[1]

--标记
local flag = tonumber(ARGV[2]) or 0

local res = {}
if(flag == 1)
then
    local min = tonumber(redis.call('hget',ACTINITKEY,'randomMin')) or 0
    local max = tonumber(redis.call('hget',ACTINITKEY,'randomMax')) or 0
    table.insert(res,min)
    table.insert(res,max)
end

if(flag == 2)
then
    local min = tonumber(redis.call('hget',ACTINITKEY,'likeMin')) or 0
    local max = tonumber(redis.call('hget',ACTINITKEY,'likeMax')) or 0
    table.insert(res,min)
    table.insert(res,max)
end


if(flag == 3)
then
    local min = tonumber(redis.call('hget',ACTINITKEY,'praisedMin')) or 0
    local max = tonumber(redis.call('hget',ACTINITKEY,'praisedMax')) or 0
    table.insert(res,min)
    table.insert(res,max)
end


if(flag == 4)
then
    local min1 = tonumber(redis.call('hget',ACTINITKEY,'randomMin')) or 0
    local max2 = tonumber(redis.call('hget',ACTINITKEY,'randomMax')) or 0
    local min3 = tonumber(redis.call('hget',ACTINITKEY,'likeMin')) or 0
    local max4 = tonumber(redis.call('hget',ACTINITKEY,'likeMax')) or 0
    local min5 = tonumber(redis.call('hget',ACTINITKEY,'praisedMin')) or 0
    local max6 = tonumber(redis.call('hget',ACTINITKEY,'praisedMax')) or 0
    table.insert(res,min1)
    table.insert(res,max2)
    table.insert(res,min3)
    table.insert(res,max4)
    table.insert(res,min5)
    table.insert(res,max6)
end




return res